package br.com.foxinline.modelo;

import br.com.foxinline.enums.AplicacaoSelo;
import br.com.foxinline.enums.TipoAtoCampo;
import java.io.Serializable;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import org.hibernate.validator.constraints.NotBlank;

/**
 *
 * @author laverson
 */
@Entity
public class TipoSelo implements Serializable{

    @Id
    @SequenceGenerator(name = "seq_tipo_selo", sequenceName = "seq_tipo_selo", allocationSize=1)
    @GeneratedValue(generator = "seq_tipo_selo", strategy = GenerationType.SEQUENCE)
    private Long id;

    @Column(length=80)
    @NotBlank
    @NotNull
    private String nome;

    private String descricao;
    
    @Enumerated(EnumType.STRING)
    private AplicacaoSelo aplicacao;
    
    private boolean status = true;

    @Column(length=7)
    @NotBlank
    @NotNull
    private String corSelo;
    
    @OneToOne
    private Cartorio cartorio;

    public TipoSelo() {}

    public TipoSelo(Long id, String nome, String descricao, AplicacaoSelo aplicacao, String corSelo, Cartorio cartorio) {
        this.id = id;
        this.nome = nome;
        this.descricao = descricao;
        this.aplicacao = aplicacao;
        this.corSelo = corSelo;
        this.cartorio = cartorio;
    }

    public AplicacaoSelo getAplicacao() {
        return aplicacao;
    }

    public void setAplicacao(AplicacaoSelo aplicacao) {
        this.aplicacao = aplicacao;
    }

    public Cartorio getCartorio() {
        return cartorio;
    }

    public void setCartorio(Cartorio cartorio) {
        this.cartorio = cartorio;
    }

    public String getCorSelo() {
        return corSelo;
    }

    public void setCorSelo(String corSelo) {
        this.corSelo = corSelo;
    }

    public String getDescricao() {
        return descricao;
    }

    public void setDescricao(String descricao) {
        this.descricao = descricao;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getNome() {
        return nome;
    }

    public void setNome(String nome) {
        this.nome = nome;
    }

    public boolean isStatus() {
        return status;
    }

    public void setStatus(boolean status) {
        this.status = status;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final TipoSelo other = (TipoSelo) obj;
        if (this.id != other.id && (this.id == null || !this.id.equals(other.id))) {
            return false;
        }
        if ((this.nome == null) ? (other.nome != null) : !this.nome.equals(other.nome)) {
            return false;
        }
        if ((this.descricao == null) ? (other.descricao != null) : !this.descricao.equals(other.descricao)) {
            return false;
        }
        if (this.aplicacao != other.aplicacao) {
            return false;
        }
        if (this.status != other.status) {
            return false;
        }
        if ((this.corSelo == null) ? (other.corSelo != null) : !this.corSelo.equals(other.corSelo)) {
            return false;
        }
        if (this.cartorio != other.cartorio && (this.cartorio == null || !this.cartorio.equals(other.cartorio))) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 37 * hash + (this.id != null ? this.id.hashCode() : 0);
        hash = 37 * hash + (this.nome != null ? this.nome.hashCode() : 0);
        hash = 37 * hash + (this.descricao != null ? this.descricao.hashCode() : 0);
        hash = 37 * hash + (this.aplicacao != null ? this.aplicacao.hashCode() : 0);
        hash = 37 * hash + (this.status ? 1 : 0);
        hash = 37 * hash + (this.corSelo != null ? this.corSelo.hashCode() : 0);
        hash = 37 * hash + (this.cartorio != null ? this.cartorio.hashCode() : 0);
        return hash;
    }

    
    
}
